"""
Provides a basic module definiton that exposes facilities used by most other modules.
"""

import canvas_elements

import text

class AbstractScene(object):
    """
    Subclass this in other modules to get access to common presentation elements.
    """
    _screen = None
    _game_data = None #A dictionary of all data needed to run the game across scenes
    #This includes static game-config data, like voice toggles and references to the content being run
    _text_history = None #A collection of textboxes produced in this scene, to allow for review
    
    _element_manager = None
    
    def __init__(self, screen, game_data):
        self._screen = screen
        self._game_data = game_data
        
        self._text_history = []
        
        self._element_manager = canvas_elements.ElementManager()
        
    def create_textbox(self, **kwargs):
        try:
            textbox = getattr(text, self._game_data['presentation']['textbox-style'])(self._screen, **kwargs)
        except:
            textbox = text.Textbox(self._screen, **kwargs)
        self._text_history.append(textbox)
        
        self._element_manager.add_element(textbox)
        
        return textbox
        
    def render(self):
        self._element_manager.render()
        
